package com.jay.io.clazz;

import java.io.CharArrayReader;
import java.io.IOException;
import java.io.PushbackReader;

public class PushbackReaderCls {

	public static void main(String[] args) throws IOException {
		String s = "if (a == 4) a = 0;/n";
		char buf[] = s.toCharArray();
		CharArrayReader in = new CharArrayReader(buf);
		PushbackReader f = new PushbackReader(in);
		int c;
		while ((c = f.read()) != -1) {
			switch (c) {
			case '=':
				if ((c = f.read()) == '=') {
					System.out.print(".eq.");
				} else {
					System.out.print("<-");
					// 退回一个字节
					f.unread(c);
				}
				break;
			default:
				System.out.print((char) c);
				break;
			}
		}
	}
}
